<template>
  <div>
    <div class="title">周末去哪儿</div>
    <ul>
      <!--border-bottom解决列表之间一像素边框-->
      <li class="weekend border-bottom" v-for="(item) in weekendList" :key="item.id">
        <!--使用div标签包裹img是为了撑开这个图片防止抖动-->
        <div class="weekend-img-wrapper">
          <img class="weekend-img" :src="item.urlImg" alt />
        </div>
        <div class="weekend-info">
          <p class="weekend-title">{{item.title}}</p>
          <p class="weekend-desc">{{item.desc}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  name: 'HomeWeekend',
  props: {
    weekendList: Array
  }
}
</script>

<style lang="stylus" scope>
@import '~@/assets/styles/mixins.styl';

.title {
  margin-top: 0.2rem;
  line-height: 0.5rem;
  background: #eeeeee;
  text-indent: 0.2rem; /* 将段落的第一行缩进4px */
}

.weekend-img-wrapper {
  overflow: hidden;
  width: 100%;
  height: 0;
  padding-bottom: 30%;

  .weekend-img {
    width: 100%;
  }
}

.weekend-info {
  padding: 0.1rem;

  .weekend-title {
    line-height: 0.54rem;
    font-size: 0.32rem;
    ellipsis();
  }

  .weekend-desc {
    line-height: 0.5rem;
    color: #cccccc;
    ellipsis();
  }
}
</style>
